//
// Copyright (c) 2024 BPer
//
#ifndef SRC_BPERWEBRTC_BPERCRTCCONTEXT_H_H_
#define SRC_BPERWEBRTC_BPERCRTCCONTEXT_H_H_

#include <bperice/BPerRtcSocket.h>
#include <bperrtc/BPerBandwidth.h>

#include <bperssl/BPerSsl.h>
#include <bperssl/BPerRtcDtls.h>

#include <bperutil/sys/BPerSRtp.h>
#include <bperutil/BPerAvInfoType.h>
#include <bperutil/sys/BPerVector.h>

#include <bperstream/BPerStreamType.h>

typedef struct{
	uint32_t ssrc;
	uint32_t rtxSsrc;
	uint32_t fecSsrc;
	uint32_t twccId;
} BPerRtcTrack;

bPer_vector_declare(BPerRtcTrack)

typedef struct{
	char *data;
	int32_t nb;
} BPerStunData;

typedef struct{
	BPerBool enableAudioTrack;
	BPerBool enableVideoTrack;

	BPerAudioCodec audioCodec;
	BPerVideoCodec videoCodec;

	BPerRtcDirection direction;

	uint32_t audioSsrc;
	uint32_t videoSsrc;
	int32_t state;
	int32_t twccId;

	BPerStreamConfig *streamConfig;
	BPerAVInfo *avinfo;
	BPerRtcSocket *sock;

#if BPer_Enable_Dtls
	BPerCertificate *cer;
	BPerRtcDtls *dtls;
	BPerSRtp srtp;
#endif

	BPerStunData stun;
	BPerRtcTrack audioTrack;
	BPerRtcTrackVector videoTracks;

	BPerBandwidth bandwidth;
	BPerRtcStats stats;
#if BPer_Enable_TWCC
	BPerRtcTwcc twcc;
#endif


} BPerRtcContext;

#endif /* SRC_BPERWEBRTC_BPERCRTCCONTEXT_H_H_ */
